<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" /> 
<title>简历</title>
<script src="js/jquery-3.1.1.min.js"></script>
<script src="js/main.js"></script>
<style>
*{
	box-sizing:border-box!important;  
	font-family: "微软雅黑";
}
.item{
	padding: 10px;
	border-bottom: 1px dashed #ddd;
}
.top{
	line-height: 35px;
}
.top a,.top div{
	display: inline-block;
}
.top span{
	padding: 0 20px 0 0;
}
.top span:last-child{
	padding: 0;
}
.top .title{
	font-size: 14px;
	line-height: 30px;	
	font-weight: bold;
}
.top .title-right{
	font-size: 12px;
	color: #666;
	display: inherit;
	line-height: 25px;
	padding: 5px 0;
}
.top .icon{
	max-width: 20px;
	max-height: 20px;
	vertical-align: middle;
}
.content,.nwork{
	word-wrap: break-word; 
	word-break: normal; 
	font-size: 13px;
}
.page{
	text-align: center;
	line-height: 30px;
}
.page li{
	display: inline;
	list-style: none;
}
.page a,.page a:link,.page a:visited{
	text-decoration:none;
	display: inline;
	padding: 3px 5px;
	border: 1px solid #eee;
	color: #333;
}
.page .active a{
	background-color: #E8F5FE;
	border-color: #A9C9E2;
}
.page .but.disabled a{
	background-color: #eee;
	color: #666;
}
.page.but{
	margin-left: 5px;
}
a small{
	color: #666;
	font-size: 12px;
	padding-left: 10px;
	font-weight: normal;
	text-decoration: none
}
a,a:link,a:visited,a:hover,a:active{text-decoration: none}
</style>

</head>
<body>
<div id="items">
<div class="item" style="display: none">
	<div class="top">
		<img class="icon" alt="" src="img/jianli.png">
		<a class="title" href="javascript:void(0)" onclick="send2client('1193',0)">
		杨春超<small>本科,5年工作经验</small>
		</a>
		<div class="title-right">(<span>联系电话&nbsp;:&nbsp;13717600928</span><span>邮箱&nbsp;:&nbsp;13717600928@139.com</span><span>婚姻状况&nbsp;:&nbsp;已婚</span><span>住址&nbsp;:&nbsp;湖北武汉</span>)</div>
	</div>
	<div class="content">对待工作认真负责，具有良好的团队合作精神和沟通能力 工作积极努力，喜欢挑战，能在较短时间内适应不同压力的工作 具有较强的学习能力和环境适应能力 4年OA工作经验，2年银行工作经验。 </div>
</div>
</div>
<h3 id='nomore' style='text-align:center;color:#666;display: none;'>没有更多数据了</h3>

<ul class="page" style="display: none">
	<li class="text">
		每页显示
		<select id="pagesize"> 
			<option value="5">5</option>
			<option value="10">10</option>
			<option value="20">20</option>
			<option value="100">100</option>
		</select>
		条数据,
	</li>
	<li class="text">共条<span id="countdata">0</span>数据,当前<span id="thispage">0/1</span>,</li>
	<li class="but" id="page-f"><a data-page="1" href="javascript:void(0)" onclick="gopage_1(this)">首页</a></li>
	<li class="but" id="page-p"><a data-page="1" href="javascript:void(0)" onclick="gopage_1(this)">上一页</a></li>
	<!-- 
	<li class="but page active"><a data-page="1" href="javascript:void(0)" onclick="gopage_1(this)">1</a></li>
	<li class="but page"><a data-page="2" href="javascript:void(0)" onclick="gopage_1(this)">2</a></li>
	<li class="but page"><a data-page="3" href="javascript:void(0)" onclick="gopage_1(this)">3</a></li>
	<li class="but page"><a data-page="4" href="javascript:void(0)" onclick="gopage_1(this)">4</a></li>
	<li class="but page"><a data-page="5" href="javascript:void(0)" onclick="gopage_1(this)">5</a></li>
	<li class="but page"><a data-page="6" href="javascript:void(0)" onclick="gopage_1(this)">...</a></li>
	 -->
	<li class="but " id="page-n"><a data-page="3" href="javascript:void(0)" onclick="gopage_1(this)">下一页</a></li>
	<li class="but " id="page-l"><a data-page="6" href="javascript:void(0)" onclick="gopage_1(this)">尾页</a></li>
</ul>
<input type="hidden" id="countpage" value="0"/>
<div id="temp-data" style="display: none;">
<div class="item">
	<div class="top">
		<img class="icon" alt="" src="img/jianli.png">
		<a class="title" href="javascript:void(0)" onclick="send2client('@cid')">
		@name<small>@sex,@dereen,@worktime</small>
		</a>
		<div class="title-right">(&nbsp;<span>联系电话&nbsp;:&nbsp;@phone</span><span>求职状态&nbsp;:&nbsp;@state</span><span style="display: none">婚姻状况&nbsp;:&nbsp;@marriage</span><span>求职地点&nbsp;:&nbsp;@address</span><span>应聘岗位&nbsp;:&nbsp;@post</span><span>期望薪资&nbsp;:&nbsp;@salary</span>&nbsp;)</div>
	</div>
	<div class="content">@introduce</div>
	<div class="nwork" style="padding-top: 5px">@nwork</div>
</div>
</div>
</body>
<script type="text/javascript">
var userAgent = navigator.userAgent.toLowerCase();
var isphone = false;
if(userAgent.indexOf("android")>=0
   		||userAgent.indexOf("iphone")>=0
   		||userAgent.indexOf("ipad")>=0
   		||userAgent.indexOf("ios")>=0
   		||userAgent.indexOf("mobile")>=0
   		||userAgent.indexOf("blackberry")>=0
   		||userAgent.indexOf("webos")>=0
   		){
	isphone = true;
}
//console.log(userAgent);
$(function(){
	$("#pagesize").val(5);
	$("#pagesize").change(function(){
		gopage(1);
	})
	//isphone = false;
	if(isphone){
		initPhone();
	}else{
		$("ul.page").show();
	}
	gopage(1);
});
$("#page").change(function(){
	gopage($(this).val());
});
var cname = GetQueryString("cname");
function gopage(page){
	var pagesize = $("#pagesize").val();
	$.ajax({
		url:api_resume_list,
		type:"post",		
		async:false,		
		data:{
			"v_v1":cname,
			"token":getToken(),
			"page.page":page,
			"page.pagesize":pagesize
		},
		success:function(data){
			console.log(data);
			if(data.code==0){
				var html_temp = $("#temp-data").html();
				$("#countdata").html(data.page.countdata);
				$("#thispage").html(data.page.page+"/"+data.page.countpage);
				setpage(data.page.page,data.page.countpage);
				var test = "对待工作认真负责，具有良好的团队合作精神和沟通能力 工作积极努力，喜欢挑战，能在较短时间内适应不同压力的工作 具有较强的学习能力和环境适应能力 4年OA工作经验，2年银行工作经验。 ";
				if(page!=1&&isphone){
					
				}else{
					$("#items").empty();
				}
				if(data.data.length>0){
					for(var i=0;i<data.data.length;i++){
						var resume = data.data[i];
						var html = html_temp;
						html = html.replace("@cid",resume["skt1.skf49"]);
						html = html.replace("@name",resume["skt1.skf5"]);
						html = html.replace("@sex",finaldata.sex(resume["skt1.skf6"]));
						html = html.replace("@dereen",finaldata.dereen(resume["skt1.skf19"]));
						html = html.replace("@worktime",getValue(resume["skt1.skf242"],"无工作经验"));
						html = html.replace("@phone",getValue(resume["skt1.skf10"],"无"));
						//html = html.replace("@email",resume["skt1.skf10"]+"@139.com");
						html = html.replace("@marriage",finaldata.marriage(""));
						html = html.replace("@address",getValue(resume["skt1.skf154"],"无"));
						html = html.replace("@salary",getValue(resume["skt1.skf25"],"无"));
						html = html.replace("@post",getValue(resume["skt1.skf2"],"无"));
						html = html.replace("@state",finaldata.state(resume["skt1.skf13"]));//求职状态
						html = html.replace("@introduce",getValue(resume["skt1.skf29"],"无自我评价"));
						html = html.replace("@nwork","最近工作单位："+getValue(resume["skt1.skf15"],"无")+",工作职位："+getValue(resume["skt1.skf14"],"无"));
						$("#items").append(html);
					}
				}
			}
		},
		error:function(e){
			
		}
	})
}

function getValue(v,df){
	if(v==null||v==""){
		return df;
	}else{
		return v;
	}
}

function setpage(page,countpage){
	$("#countpage").val(countpage);
	$("#page-l a").attr("data-page",countpage);
	$("#page-p a").attr("data-page",(page-1));
	if(page==1){
		$("#page-p a").attr("data-page",1);
	}
	$("#page-n a").attr("data-page",(page+1));
	if(page==countpage){
		$("#page-n a").attr("data-page",(countpage));
	}
	var html = "";
	if(countpage<=5){
		for(var i=1;i<=countpage;i++){
			var active=(i==page?"active":"")
			var html_temp = '<li class="but page '+active+'"><a data-page="'+i+'" href="javascript:void(0)" onclick="gopage_1(this)">'+i+'</a></li>'
			html+=html_temp;
		}
	}else{
		if(page<=3){
			for(var i=1;i<=countpage&&i<=5;i++){
				var active=(i==page?"active":"")
				var html_temp = '<li class="but page '+active+'"><a data-page="'+i+'" href="javascript:void(0)" onclick="gopage_1(this)">'+i+'</a></li>'
				html+=html_temp;
			}
		}else if(page>=countpage-3){
			var html_temp = '<li class="but page"><a data-page="'+(countpage-5)+'" href="javascript:void(0)" onclick="gopage_1(this)">...</a></li>'
			html+=html_temp;
			for(var i=countpage-4;i<=countpage&&i<=page+2;i++){
				var active=(i==page?"active":"")
				var html_temp = '<li class="but page '+active+'"><a data-page="'+i+'" href="javascript:void(0)" onclick="gopage_1(this)">'+i+'</a></li>'
				html+=html_temp;
			}
		}else{
			var html_temp = '<li class="but page"><a data-page="'+(page-3)+'" href="javascript:void(0)" onclick="gopage_1(this)">...</a></li>'
			html+=html_temp;
			for(var i=page-2;i<=countpage&&i<=page+2;i++){
				var active=(i==page?"active":"")
				var html_temp = '<li class="but page '+active+'"><a data-page="'+i+'" href="javascript:void(0)" onclick="gopage_1(this)">'+i+'</a></li>'
				html+=html_temp;
			}
		}
		if(countpage>page+2){
			var html_temp = '<li class="but page"><a data-page="'+(page+3)+'" href="javascript:void(0)" onclick="gopage_1(this)">...</a></li>'
			html+=html_temp;
		}
	}
	
	$(".but.page").remove();
	$("#page-p").after(html);
	//$(".but.page").removeClass("active");
	//$(".but.page a[data-page='"+page+"']").parent().addClass("active");
}
function gopage_1(th){
	gopage($(th).attr("data-page"));
}

/**
 * 获取地址栏后面的参数
 */
function GetQueryString(name)
{
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  decodeURI(r[2]); return null;
}
/**
 * 初始化
 */
function initPhone(){
	var page = 1;
	var subing = false;
	var countpage = parseInt($("#countpage").val());
	$("ul.page").hide();
	if(10 >= $(document).height() - $(window).height()){
		if(page==countpage){
        	return;
        }
        if(!subing){//如果不在提交中
        	scrollpage();
        }
	}
	$(window).scroll(function() {
	    if ($(document).scrollTop()+10 >= $(document).height() - $(window).height()) {
	        if(page==countpage){
	        	return;
	        }
	        if(!subing){//如果不在提交中
	        	scrollpage();
	        }
	    }
	});
	function scrollpage(){
		subing = true;
		gopage(page);
		page++;
		subing = false;
		
	}
}
function send2client(cid){
	location.href="temp_resume.html?cid="+cid;
}
</script>
</html>